from flask import Flask, Blueprint
from applications.view.system.file import bp as file_bp
from applications.view.system.index import bp as index_bp
from applications.view.system.log import bp as log_bp
from applications.view.system.passport import bp as passport_bp
from applications.view.system.power import bp as power_bp
from applications.view.system.rights import bp as right_bp
from applications.view.system.role import bp as role_bp
from applications.view.system.user import bp as user_bp
from applications.view.system.dept import bp as dept_bp

# 新增模块需补充注册蓝图代码
from applications.view.system.settings import bp as settings_bp
from applications.view.system.software import bp as software_bp
from applications.view.system.kami import bp as kami_bp
from applications.view.system.access import bp as access_bp
from applications.view.system.api import bp as api_bp
from applications.view.system.task import bp as task_bp

# 创建system蓝图
system_bp = Blueprint('system', __name__, url_prefix='/admin/system')


def register_system_bps(app: Flask):
    # 在admin_bp下注册子蓝图
    system_bp.register_blueprint(user_bp)
    system_bp.register_blueprint(file_bp)
    system_bp.register_blueprint(log_bp)
    system_bp.register_blueprint(power_bp)
    system_bp.register_blueprint(role_bp)
    system_bp.register_blueprint(passport_bp)
    system_bp.register_blueprint(right_bp)
    system_bp.register_blueprint(dept_bp)

    # 新增模块system全局注册蓝图代码
    system_bp.register_blueprint(settings_bp) # 新增模块applications.view.system.settings目录下创建settings.py文件：
    system_bp.register_blueprint(software_bp) # 在applications.view.system.software目录下创建software.py文件：
    system_bp.register_blueprint(kami_bp)  # 在applications.view.system.kami目录下创建kami.py文件： 卡密发卡管理
    system_bp.register_blueprint(access_bp)
    system_bp.register_blueprint(task_bp)  # 在applications.view.system.task目录下创建task.py文件： 定时任务

    # 新增模块app全局注册蓝图代码
    app.register_blueprint(api_bp)  # 系统接口，必须,全局注册，否则无法访问,放在最后
    app.register_blueprint(index_bp)  # 系统首页，必须,全局注册，否则无法访问,放在最后
    app.register_blueprint(system_bp) # 系统管理，必须,全局注册，否则无法访问,放在最后
    
    # app.register_blueprint(settings_bp)
    # app.register_blueprint(dbms_bp)



